package com.markyao.controller;

import com.markyao.dao.pojo.User;
import com.markyao.service.OrderService;
import com.markyao.vo.CartVo;
import com.markyao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    OrderService orderService;

    @PostMapping("create")
    public Result createOrder(Integer aid,Integer[]cids, HttpSession session){
        User user = (User) session.getAttribute("user");
        Integer uid = user.getUid();
        String username = user.getUsername();

        return orderService.addOrder(aid,uid,cids,username);
    }
}
